#!/bin/sh

export DEALTYPE=$1

function install()
{
	cp ./etc/DispatchAssist.xml /opt/FUDE/fude/etc/guard/conf.d/
	fudeguardmgr.py --r
	echo "DispatchAssist install done"
}

function uninstall()
{
	rm -rf /opt/FUDE/fude/etc/guard/conf.d/DispatchAssist.xml
	fudeguardmgr.py --r
	pkill -f DispatchAssist.py
	echo "DispatchAssist uninstall done"
}

# 脚本使用提示
function usage()
{
	echo "*************************** Usage**************************************"
	echo "*sh install.sh  <DealType>                                            *"
	echo "*Example:                                                             *"
	echo "*sh install.sh  install                                               *"
	echo "*sh install.sh  uninstall                                             *"
	echo "***********************************************************************"
}

# 程序入口
case "$DEALTYPE" in
	# 安装
	install)
		install
		;;
	# 卸载
	uninstall)
		uninstall
		;;
	# 提示输入错误
	*)
	echo "Dealtype $DEALTYPE doesn't support"
	usage
	exit 1
esac
